#include <iostream>
#include <algorithm>
using namespace std;

/*
    for_each() 遍历容器
        for_each(start, end, func)
            将start到end区间中的数据进行func操作
*/


int main()
{
    int a[5] = {1, 2, 3, 4, 5};

    for_each(a, a + 5, [](int i) { cout << i << " "; });
    cout << endl;

    for_each(a, a + 5, [](int &i) { i *= 2; cout << i << " "; });

  
    return 0;
}